package com.zjw.zy.bean;

import android.os.Parcel;
import android.os.Parcelable;

import androidx.annotation.NonNull;

/**
 * @author ：zhong.jw
 * @date ：Created in 2022/10/17 11:57
 */
public class NearWeather implements Parcelable {
    @NonNull
    private final String title;
    @NonNull
    private final String text;

    private final int nearHours;

    @NonNull
    private final HourlyWeather hourlyWeather;


    @NonNull
    public String getTitle() {
        return title;
    }

    @NonNull
    public String getText() {
        return text;
    }

    public int getNearHours() {
        return nearHours;
    }

    @NonNull
    public HourlyWeather getHourlyWeather() {
        return hourlyWeather;
    }

    public NearWeather(@NonNull String title, @NonNull String text, int nearHours, @NonNull HourlyWeather hourlyWeather) {
        this.title = title;
        this.text = text;
        this.nearHours = nearHours;
        this.hourlyWeather = hourlyWeather;
    }

    protected NearWeather(Parcel in) {
        title = in.readString();
        text = in.readString();
        nearHours = in.readInt();
        hourlyWeather = in.readParcelable(HourlyWeather.class.getClassLoader());
    }

    public static final Creator<NearWeather> CREATOR = new Creator<NearWeather>() {
        @Override
        public NearWeather createFromParcel(Parcel in) {
            return new NearWeather(in);
        }

        @Override
        public NearWeather[] newArray(int size) {
            return new NearWeather[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(title);
        dest.writeString(text);
        dest.writeInt(nearHours);
        dest.writeParcelable(hourlyWeather, flags);
    }
}
